From 1ca40532d35590ded2bbe92877efbbaa64993652 Mon Sep 17 00:00:00 2001 From: robertlipe Date: Sat, 8 Dec 2012 07:52:13 +0000 Subject: [PATCH] Lowranceusr4: don't try to compute date on invalid input. --- gpsbabel/lowranceusr4.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gpsbabel/lowranceusr4.c b/gpsbabel/lowranceusr4.c index f83164ccc..7c00c01fe 100644 --- a/gpsbabel/lowranceusr4.c +++ b/gpsbabel/lowranceusr4.c @@ -437,7 +437,14 @@ lowranceusr4_parse_waypoints(void) time is a unix timestamp. */ create_date = gbfgetint32(file_in); create_time = gbfgetint32(file_in); - wpt_tmp->creation_time = lowranceusr4_get_timestamp(create_date, create_time); + + // Julian date 2440487 is 1/1/1970. If that's the date we're working + // with, as a practical matter, we have no date, so don't even compute + // or set it. + if (create_date > 2440587) { + wpt_tmp->creation_time = lowranceusr4_get_timestamp(create_date, + create_time); + } /* Unused byte */ gbfgetc(file_in); -- 2.30.2